package com.yusheng.utils;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class FilePathUtils {

    public static String getTemplatePath(String directory,String name){
        String path = "C:"+directory+name;
        // linux 路径需要转义
        if (isLinux()){
            path = path.replace("\\", "/");
        }
//        ClassPathResource resource = new ClassPathResource(directory+name);
//        try {
//            log.info("************{}",resource.getFile().getCanonicalPath());
//            return resource.getFile().getCanonicalPath();
//        } catch (IOException e) {
//            throw new ServiceException(e.getMessage());
//        }
        return path;
    }
    public static boolean isLinux() {
        return System.getProperty("os.name").toLowerCase().contains("linux");
    }

    public static boolean isWindows() {
        return System.getProperty("os.name").toLowerCase().contains("windows");
    }
}
